#include <unistd.h>
#include "threadpool.h"

void *my_print(void *arg)
{
	int *i = (int *)arg;
	printf("thread_id:%d param:%d\n", GET_THREAD_ID, *i);

	sleep(1);
	free(i);
	return NULL;
}

int main()
{
	threadpool_t *pool = threadpool_create(3);

	for (int i = 0; i < 10; ++i)
	{
		int *te = malloc(sizeof(int));
		*te = i;
		threadpool_add_task(pool, my_print, te);
	}
	
	//sleep(15);
	threadpool_destroy(pool);

	return 0;
}
